<?php
include("/home/share/www/SourceSite-utf8/secure/crontab/AllWeb.inc.php");
foreach($arrWeb as $strWeb){
	if($strWeb == "SourceSite")continue;
	if($strWeb == "SourceSite-utf8")continue;

	print ("$strWeb...<br><hr><br>\n");
	$_SERVER["DOCUMENT_ROOT"] = "/home/share/www/".$strWeb."/secure";
	$strCFile = $_SERVER["DOCUMENT_ROOT"]."/indexpage/db.inc.php";
	$strDBFile = $_SERVER["DOCUMENT_ROOT"]."/db.inc.php";

	if(file_exists($strCFile))unlink($strCFile);
	if(file_exists($strDBFile)){
		$arrCon = file($strDBFile);
		$strCon = implode("", $arrCon);
		if(preg_match("/blDBName.+=.+\"(.+)\"/", $strCon, $arrMatch)){
			$arrMatch[1] = preg_replace("/^bet/", "", $arrMatch[1]);
			$arrMatch[1] = preg_replace("/UTF8$/", "", $arrMatch[1]);

			$strCon = '<?php'."\n".'$_blDBName = "'.$arrMatch[1].'"'."\n".'?>';
			if(!$fp = fopen($strCFile, "w"))print "Can't open file!!\n";
			if(!fwrite($fp, $strCon))print "Can't write file!!\n";
			fclose($fp);
		}
		print "OK \n";
	}
	print "End \n";
}
?>